﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Collections;

using Willson.JsbManager.Entity;
using Willson.JsbManager.Idal;

namespace Willson.JsbManager.Dal
{
    public class DAL_table_xt_user:BaseDal<Table_xt_user_entity>,ITableXtUser
    {
        #region 对象实例及构造函数

		public static DAL_table_xt_user Instance
		{
			get
			{
				return new DAL_table_xt_user();
			}
		}
        public DAL_table_xt_user(): base("table_xt_user", "id",string.Empty,true)
		{ }

        #endregion

        /// <summary>
        /// 将DataReader的属性值转化为实体类的属性值，返回实体类
        /// </summary>
        /// <param name="dr">有效的DataReader对象</param>
        /// <returns>实体类对象</returns>
        protected override Table_xt_user_entity DataReaderToEntity(IDataReader dataReader)
        {
            Table_xt_user_entity entity = new Table_xt_user_entity();
            SmartDataReader reader = new SmartDataReader(dataReader);

            entity.Id = reader.GetInt32("id");
            entity.Name = reader.GetString("name");
            entity.Pwd = reader.GetString("pwd");
  
            return entity;
        }

        /// <summary>
        /// 将实体对象的属性值转化为Hashtable对应的键值(用于插入或者更新操作)
        /// (提供了默认的反射机制获取信息，为了提高性能，建议重写该函数)
        /// </summary>
        /// <param name="obj">有效的实体对象</param>
        /// <returns>包含键值映射的Hashtable</returns>
        protected override Hashtable GetHashByEntity(Table_xt_user_entity obj)
        {
            Table_xt_user_entity info = obj as Table_xt_user_entity;
            Hashtable hash = new Hashtable();

            hash.Add("id", info.Id);
            hash.Add("name", info.Name);
            hash.Add("pwd", info.Pwd);

            return hash;
        }
	
    }
}
